package manager

import (
	"gitcode.com/G-YT/iHealth25/server/model/system"
	"gorm.io/gorm"
	"time"
)

type Login interface {
	GetHmId() uint
	GetName() string
	GetPhone() string
	GetAuthorityId() uint
}

var _ Login = new(FdHealthManager)

// FdHealthManager 健管师结构体
type FdHealthManager struct {
	CreatedAt          time.Time       // 创建时间
	UpdatedAt          time.Time       // 更新时间
	DeletedAt          gorm.DeletedAt  `gorm:"index" json:"-"`                                                                    // 删除时间
	HmId               uint            `json:"hmId" form:"hmId" gorm:"column:hm_id;comment:;size:19;primarykey;AUTO_INCREMENT;"`  //hmId字段
	StoreId            uint            `json:"storeId" form:"storeId" gorm:"column:store_id;comment:健管中心ID;size:10;"`             //关联健管中心ID
	HealthManageCenter *system.SysUser `json:"healthManageCenter" form:"-" gorm:"->;foreignKey:StoreId;references:ID;"`           // 服务站关联信息
	Phone              string          `json:"phone" form:"phone" gorm:"column:phone;comment:手机号/账号;size:191;"`                   //手机号/账号
	StudentID          string          `json:"studentID" form:"studentID" gorm:"column:studentID;comment:学号;size:191;"`           // 学号
	Password           string          `json:"password" form:"password" gorm:"column:password;comment:密码;size:191;"`              //密码
	Name               string          `json:"name" form:"name" gorm:"column:name;comment:名称;size:191;"`                          //名称
	Sex                *int            `json:"sex" form:"sex" gorm:"column:sex;default:1;comment:性别 1男 2女;"`                      //性别 1男 2女
	HeaderImg          string          `json:"headerImg" form:"headerImg" gorm:"column:header_img;comment:头像;size:191;"`          //头像
	IsRegister         *bool           `json:"isRegister" form:"isRegister" gorm:"column:is_register;comment:是否注册;default:true"`  //是否注册
	IsAudit            *bool           `json:"isAudit" form:"isAudit" gorm:"column:is_audit;default:false;comment:是否审核;"`         //是否审核
	DirectNum          *int            `json:"directNum" form:"directNum" gorm:"column:direct_num;comment:直推用户人数;size:19;"`       //直推用户人数
	IndirectNum        *int            `json:"indirectNum" form:"indirectNum" gorm:"column:indirect_num;comment:间推用户人数;size:19;"` //间推用户人数
	Grade              uint            `json:"grade" form:"grade" gorm:"column:grade;comment:等级 1初级 2中级 3高级;size:19;default:1"`   //等级 1初级 2中级 3高级
	ServedNum          *int            `json:"servedNum" form:"servedNum" gorm:"column:served_num;comment:服务人数;size:19;"`         //服务人数
	IDCard             string          `json:"IDCard" form:"IDCard" gorm:"column:IDCard;comment:身份证号;size:19;"`                   //身份证号
	Certificate        string          `json:"certificate" form:"certificate" gorm:"column:certificate;comment:头像;size:191;"`     //资格证书
	Score              uint            `json:"score" form:"score" gorm:"column:score;comment:评分;size:19;"`                        //评分
	Code               string          `json:"code" form:"code" gorm:"-"`
	Level              int             `json:"level" form:"level" gorm:"column:level;comment:等级;size:19;"`                    //等级 0初级 1中级 2高级
	OpenNum            uint            `json:"openNum" form:"openNum" gorm:"column:open_num;default:0;comment:开通数量;size:19;"` // 授权开通数量
}

// TableName fdHealthManager表 FdHealthManager自定义表名 fd_health_manager
func (FdHealthManager) TableName() string {
	return "fd_health_manager"
}

func (f *FdHealthManager) GetHmId() uint {
	return f.HmId
}

func (f *FdHealthManager) GetName() string {
	return f.Name
}

func (f *FdHealthManager) GetPhone() string {
	return f.Phone
}

func (f *FdHealthManager) GetAuthorityId() uint {
	return 8888
}
